package org.sunflower.clean.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

/**
 * @description:
 * @author: TanJingyu
 * @create: 2021-09-29 14:47
 **/
@RestController
@RequestMapping("/cookie")
public class CookieController {

    @GetMapping
    public String cookie(HttpServletResponse response) {
        Cookie cookie = new Cookie("username", "公子");
        cookie.setHttpOnly(true);
        cookie.setDomain("codert.com");
//        cookie.setPath();

        response.addCookie(cookie);
        return "success...";
    }
}
